#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<iostream>
using namespace std;

void Swap(int& a, int& b)
{
	int c = a;
	a = b;
	b = c;
}

void BubbleSort(int* a, int n)
{
	for (int i = 0; i < n - 1; ++i)
	{
		int j = 0;
		for (; j < n-i-1; ++j)
		{
			if (a[j] > a[j + 1])
			{
				Swap(a[j], a[j + 1]);
			}

		}

	}
}

int main()
{
	int a[] = { 5,4,8,2,6,7,3,0 };
	BubbleSort(a, 8);
	for (int i = 0; i < 8; ++i)
	{
		cout <<  a[i]  <<" ";
	}
	cout << "\n";
}